<!DOCTYPE html>
<html>
<head>
<title>私有属性和私有方法</title>
</head>
<body>
    <script type="text/javascript">
        function Gadget(){
            var name = 'iPod';
            this.getName = function(){
                return name;
            }
        }
        Gadget.prototype = (function(){
            var browser = "Mobile Webkit";
            return {
                getBrowser:function(){
                    return browser;
                }
            }
        }());

        var toy = new Gadget();
        console.log(toy.getName());
        console.log(toy.getBrowser());
    </script>
</body>
</html>